package ThreadDemo.Test;

/**
 * 多线程数据共享
 * @author cclove
 *
 */
public class Thread1 extends Thread{
	private int count=0;
	@Override
	public synchronized void run() {
		count++;
		System.out.println(Thread.currentThread().getName()+"   count="+count);
	}
	public static void main(String[] args) {
		Thread1 thrd=new Thread1();
		new Thread(thrd, "thread1").start();
		new Thread(thrd, "thread2").start();
		new Thread(thrd, "thread3").start();
		new Thread(thrd, "thread4").start();
	}
}
